﻿
namespace FeedbackNetwork.network
{
    public abstract class Loss
    {

        /// <summary>
        /// 计算真实样本与模型预测输出值之间的Loss值
        /// </summary>
        /// <param name="predict">模型的预测输出</param>
        /// <param name="real">真实标签值</param>
        /// <returns></returns>
        public abstract FloatTensor GetLoss(FloatTensor predict, FloatTensor real);


        /// <summary>
        /// 计算该Loss函数的导数，并与模型的预测值相乘，得到反向传播时所需要的梯度
        /// </summary>
        /// <param name="predict">模型的预测输出</param>
        /// <param name="real">真实标签值</param>
        /// <returns></returns>
        public abstract FloatTensor[] Delta(FloatTensor predict, FloatTensor real);
    }
}
